<?php
Route::group(['namespace' => 'Admin', 'prefix' => 'admin'], function () {
    Route::get('login', 'LoginController@index')->name('login');
    Route::post('login', 'LoginController@signIn');

    Route::group(['middleware' => 'guest:web'], function () {
        Route::get('logout', 'LoginController@logout')->name('logout');
        Route::get('/', 'IndexController@index');
        Route::get('index', 'IndexController@index')->name('index');
        Route::get('forbidden', 'IndexController@forbidden')->name(403);
        Route::put('cache', 'IndexController@flushCache')->name('cache.flush');
        Route::delete('cache', 'IndexController@cleanCache')->name('cache.clean');
        Route::get('first', 'IndexController@first')->name('first');
		Route::post('guildsearch', 'GuildController@guildsearch')->name('guildsearch');
		Route::post('kfupload', 'AgsysController@kfupload')->name('kfupload');
		
        Route::group(['middleware' => 'rbac'], function () {
            Route::resource('user', 'UsersController', ['except' => ['show', 'destroy']]);
            Route::put('user/{user}', 'UsersController@update')->name('user.update');
            Route::patch('user/{user}', 'UsersController@updateStatus')->name('user.active');
            Route::get('user/{user}/password', 'UsersController@editPwd')->name('user.safe');
            Route::patch('user/{user}/password', 'UsersController@updatePwd')->name('user.safe');

            Route::resource('rule', 'RulesController', ['except' => ['show']]);
            Route::resource('role', 'RolesController', ['except' => ['show', 'create', 'edit']]);
            Route::get('role/{role}/rule', 'RolesController@setRules')->name('role.set');
            Route::patch('role/{role}/rule', 'RolesController@settedRules')->name('role.setted');
			
			Route::prefix('statis')->group(function () {
				Route::get('/', 'StatisController@index')->name('statis.index');
			});
			//主播管理
			Route::prefix('guild')->group(function () {
				Route::get('/', 'GuildController@index')->name('guild.index');
				Route::get('create', 'GuildController@create')->name('guild.create');
				Route::post('store', 'GuildController@store')->name('guild.store');
				Route::get('edit/{id}', 'GuildController@edit')->name('guild.edit');
				Route::post('update/{id}', 'GuildController@update')->name('guild.update');
			    Route::patch('active/{id}', 'GuildController@updateStatus')->name('guild.active');
			    Route::get('/anchor/{gid}', 'GuildController@anchor')->name('guild.anchor');
			});
			//统计报表管理
			Route::prefix('report')->group(function () {
				Route::get('/', 'ReportController@index')->name('report.index');	//礼物
				Route::get('video', 'ReportController@video')->name('report.video'); //短视频记录
				Route::get('stamp', 'ReportController@stamp')->name('report.stamp'); // 邮票记录
				Route::get('call', 'ReportController@call')->name('report.call'); //通话记录
			});
			
			//财务管理
			Route::prefix('draw')->group(function () {
				Route::get('/', 'DrawController@index')->name('draw.index');
				Route::get('edit/{id}', 'DrawController@edit')->name('draw.edit');
				Route::put('update/{id}', 'DrawController@update')->name('draw.update');				
				Route::get('alipay', 'DrawController@alipay')->name('draw.alipay');
				Route::get('editalipay/{id}', 'DrawController@editalipay')->name('draw.editalipay');
				Route::put('updatealipay/{id}', 'DrawController@updatealipay')->name('draw.updatealipay');
				Route::get('upalipay/{id}', 'DrawController@upalipayone')->name('draw.upalipayone');
				Route::post('upalipay/{id}', 'DrawController@upalipay')->name('draw.upalipay');
				Route::get('income', 'DrawController@income')->name('draw.income');
				Route::get('earning', 'DrawController@earning')->name('draw.earning');
				Route::get('exportlearning', 'DrawController@exportlearning')->name('draw.exportlearning');
			});
			//公告管理
			Route::prefix('announ')->group(function () {
				Route::get('/', 'AnnounController@index')->name('announ.index');
				Route::get('create', 'AnnounController@create')->name('announ.create');
				Route::post('create', 'AnnounController@createadd')->name('announ.createadd');
				Route::get('edit/{id}', 'AnnounController@edit')->name('announ.edit');
				Route::post('edit/{id}', 'AnnounController@update')->name('announ.update');
				//Route::patch('de/{user}', 'UsersController@updateStatus')->name('user.active');
				Route::delete('/delete/{id}', 'AnnounController@delete')->name('announ.delete');
			});
			//系统设置
			Route::prefix('agsys')->group(function () {
				Route::get('kefu', 'AgsysController@kefu')->name('agsys.kefu');  //客服
				Route::post('kefu', 'AgsysController@kefu')->name('agsys.kefu'); //客服
				Route::get('prom', 'AgsysController@prom')->name('agsys.prom');  //推广
				Route::post('prom', 'AgsysController@prom')->name('agsys.prom'); //推广
				
				Route::get('qrcode', 'AgsysController@qrcode')->name('agsys.qrcode');
			});
        });

    });
    Route::get('test', 'TestController@test')->name('test');
});
